<?php

if (!defined('IN_ECS'))
{
	die('Hacking attempt');
}

function add_order($data)
{
	$url = "http://121.33.205.117:18080/customs/rest/custjson/addOrder.do";
// 	$url = "http://14.18.154.45:8009/customs/rest/custjson/addOrder.do";
	$result = get_content($url,$data);
	return $result;
}

function get_order_info($data)
{
	$url = "http://121.33.205.117:18080/customs/rest/custjson/orderprocessinfo.do";	
// 	$url = "http://14.18.154.45:8009/customs/rest/custjson/orderprocessinfo.do";
	$result = get_content($url,$data);
	return $result;
}

function get_content( $url , $param = array() )
{

	$data = json_encode($param);
	// 	echo $params;
	$header = array("Accept-Charset: utf-8");
	// 	echo $data.'<br/>';
	file_put_contents('/log/zzpush.txt', '【'.date('Y-m-d H:i:s',$_SERVER['REQUEST_TIME']).'】'.$data.PHP_EOL);
	$ch = curl_init();//初始化，创建句柄
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_URL, $url);//设置细节参数
	curl_setopt($ch, CURLOPT_HTTPHEADER, $header); //设置头信息的地方
	curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
	curl_setopt($ch , CURLOPT_RETURNTRANSFER , 1);
	$str = curl_exec($ch);//获取内容
	curl_close($ch);
	$content =  json_decode($str,true);
	return $content;
}